package soccerteam.model.dao;

import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import baseballteam.vo.GameInfoVO;

import soccerteam.vo.PlayerInfoVO;
import soccerteam.vo.PlayerVO;
import soccerteam.vo.SCGameInfoVO;
import soccerteam.vo.SoccerTeamVO;

public class SoccerTeamDAO {
	private SqlMapClientTemplate client;
	public SoccerTeamDAO(SqlMapClientTemplate client){
		this.client = client;
	}
	public ArrayList selectAllTeam() {
		return (ArrayList)client.queryForList("SCselectAllTeam");
	}
	public SoccerTeamVO selectTeamInfo(String id) {
		return (SoccerTeamVO)client.queryForObject("SCselectTeamInfo",id);
	}
	public ArrayList selectPlayer(String id) {
		return (ArrayList)client.queryForList("SCselectPlayer", id);
	}
	public PlayerVO selectPlayerInfo(String playerNo) {
		
		return (PlayerVO)client.queryForObject("SCselectPlayerInfo",playerNo);
	}
	public ArrayList listPlayerInfo(String playerNo) {
		
		return (ArrayList)client.queryForList("SClistPlayerInfo", playerNo);
	}
	public ArrayList listGameInfo() {
		
		return (ArrayList)client.queryForList("SCselectGameInfo");
	}
	public ArrayList insertTeam(SoccerTeamVO svo) throws SQLException{
		client.insert("SCinsertTeam" , svo);
		return (ArrayList)client.queryForList("SCselectAllTeam");
	}
	public ArrayList deleteTeam(String team_name) throws SQLException{
		client.delete("SCdeleteTeamByName", team_name);
		return (ArrayList)client.queryForList("SCselectAllTeam");
	}
	public ArrayList updateTeam(SoccerTeamVO svo) throws SQLException{
		client.update("SCupdateTeam",svo);
		return (ArrayList)client.queryForList("SCselectAllTeam");
	}
	public PlayerVO selectPlayerByName(String playerName) {
		return (PlayerVO)client.queryForObject("SCselectPlayerByName", playerName);
	}
	public void insertPlayer(PlayerVO pvo) {
		client.insert("SCinsertPlayer",pvo);
	}
	public void deletePlayer(String playerNo) {
		client.delete("SCdeletePlayer", playerNo);
	}
	public void updatePlayer(PlayerVO pvo) {
		client.update("SCupdatePlayer", pvo);
	}
	public int selectPitcherInfoNo() {
	
		return (Integer)client.queryForObject("SCselectPitcherInfoNo");
	}
	public void insertPlayerInfo(PlayerInfoVO pvo) {
		client.insert("SCinsertPlayerInfo", pvo);
	}
	public void deletePlayerInfo(String no) {
		client.delete("SCdeletePlayerInfo",no);
	}
	public ArrayList deleteGameInfo(String play_no) {
		client.delete("SCdeleteGameInfo",play_no);
		return (ArrayList)client.queryForList("SCselectGameInfo");
	}
	public ArrayList insertGameInfo(SCGameInfoVO gvo) {
		client.insert("SGinsertGameInfo",gvo);
		return (ArrayList)client.queryForList("SCselectGameInfo");
	}
	

}













